import 'package:flutter/material.dart';
import 'package:tiktokadult/hj_model/video_model.dart';
import 'package:tiktokadult/hj_utils/screen.dart';
import 'package:tiktokadult/hj_utils/widget_utils.dart';
import 'package:tiktokadult/tools_base/widget/net_image_widget.dart';

import '../../../../tools_base/widget/follow_button.dart';
import '../../../home_business/widget/collect_status_wrapper.dart';
import '../community_tag_controller.dart';

class TagDetailHeader extends StatelessWidget {
  final TagsBean model;
  final CommunityTagController controller;

  const TagDetailHeader({super.key, required this.model, required this.controller});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Color(0xff151515),
      padding: EdgeInsets.only(top: kToolbarHeight + screen.paddingTop + 12, left: 16, right: 16),
      height: 90,
      child: Row(
        children: [
          NetworkImageLoader(
            imageUrl: model.coverImg ?? '',
            width: 90,
            height: 90,
            borderRadius: 9,
          ),
          12.sizeBoxW,
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(
                  '#${model.name ?? ''}',
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 16,
                    fontWeight: FontWeight.w500,
                  ),
                ),
                6.sizeBoxH,
                Text(
                  "${model.videoCount.humanizeFormat}个帖子",
                  style: TextStyle(color: Color(0xff999999), fontSize: 14),
                ),
                6.sizeBoxH,
                Text(
                  "${model.playCount.humanizeFormat}浏览",
                  style: TextStyle(color: Color(0xff999999), fontSize: 14),
                ),
              ],
            ),
          ),
          8.sizeBoxW,
          CollectStatusWrapper(
            tagModel: model,
            builder: () => FollowButton(
              key: ValueKey("tag_${controller.model.hasCollected ?? false}"),
              mediaId: controller.model.id,
              isFollow: controller.model.hasCollected ?? false,
              followType: FollowEnum.tag,
              successsAction: (success) => controller.model.hasCollected = success,
            ),
          ),
        ],
      ),
    );
  }
}
